package com.example.demo.edu;


import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Map.Entry;
import java.util.Set;

/**
 * 类的说明
 *
 * @author 1
 */
public class RefTest {

    /**
     * 方法说明
     *
     * @param args
     * @return
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
        List<String> list = new ArrayList<>();
        Map<Integer, String> map = new HashMap<>();
        Test test = new Test();
        list.add("");
        String str = test.getStr();
        if (str.equals(Test.CON)) {// NG

        }
        if (Test.CON.equals(str)) {// OK

        }

        if (Test.CON.equals("常量")) {
            System.out.println("");
            //
        } else {
            // nothing
        }
        switch (Test.CON) {
            case "定数":
            case "常量":
            default:
        }

        for (int i = 0; i < 10; i++) {
            if (i == 0) {

            }
        }

        for (String s : list) {

        }

        Set<Integer> set = map.keySet();
        Iterator<Integer> it = set.iterator();
        while (it.hasNext()) {
            Integer key = it.next();
            String val = map.get(key);
        }

        for (Entry<Integer, String> entry : map.entrySet()) {
            Integer key = entry.getKey();
            String val = entry.getValue();
        }

        FileInputStream fis = null;
        try {
            fis = new FileInputStream("");
        } catch (FileNotFoundException e) { // OK

        } catch (IOException e) { // NG

        } catch (Exception e) { // NG

        }
//        List<String> list1 = null;

        List<String> list1 = test.getList();

        test.setList(list1);
        test.setList(new LinkedList<>());
        ArrayList<String> list2 = new ArrayList<>();// NG
        List<String> list3 = new ArrayList<>(); // OK
        list3 = new LinkedList<>(); // OK

        // nullpointexception
        if (Test.CON.equals(str) & str.equals(Test.CON)) {//NG

        }
        if (Test.CON.equals(str) && str.equals(Test.CON)) {//OK

        }
        if (Test.CON.equals(str) || str.equals(Test.CON)) {//OK

        }
        List<String> l = test.getList();
        if (l != null) {
            for (String string : l) {

            }
        }
        Long lVal = null;
        if (lVal != null) {
            String s = String.valueOf(lVal);
        }
        // s = "10";
        // s = "null";
//        if (s != null) {
//        	
//        }
        if (test.getStr() != null && test.getStr2() != null) {

            String string = test.getStr() + test.getStr2();
        }
//        string = "123456null";

        Date date1 = new Date();
        Date date2 = new Date();
        if (date1.before(date2) || date1.after(date2)) {

        }
        date1.getTime();
        Calendar cal = Calendar.getInstance();
        cal.get(Calendar.YEAR);
        cal.get(Calendar.MONTH);
        cal.add(Calendar.DATE, 3);


    }
}
